//package com.lngsyz.dzzz.config;
//
//import javax.sql.DataSource;
//
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import com.alibaba.druid.pool.DruidDataSource;
//
//@Configuration
//@MapperScan(basePackages = "com.lngsyz.dzzz.mapper.source2",sqlSessionFactoryRef = "source2SessionFactory")
//public class DataSource2Config {
//	@Value("${spring.datasource.druid.db2.url}")
//    private String url;
//    @Value("${spring.datasource.druid.db2.username}")
//    private String username;
//    @Value("${spring.datasource.druid.db2.password}")
//    private String password;
//    @Value("${spring.datasource.driver-class-name}")
//    private String driverClassName;
//	
//    @Bean(name = "dataSource2")
//    @ConfigurationProperties("spring.data-source2")
//    public DruidDataSource oracleDataSource(){
//    	DruidDataSource datasource = new DruidDataSource();
//        datasource.setUrl(this.url);
//        datasource.setUsername(username);
//        datasource.setPassword(password);
//        datasource.setDriverClassName(driverClassName);
//        System.out.println("db2 init");
//        return datasource;
//    }
//
//    @Bean(name = "source2SessionFactory")
//    public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSource2") DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
//        sessionFactoryBean.setDataSource(dataSource);
//        sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
//                .getResources("classpath*:mapper/source2/*.xml"));
//        return sessionFactoryBean.getObject();
//    }
//
//    @Bean(name = "source2TransactionManager")
//    public DataSourceTransactionManager oracleTransactionManager(){
//        return new DataSourceTransactionManager(oracleDataSource());
//    }
//}
